Get post ID outside of the loop

I am trying to accomplish something somewhat simple I think. I have a menu item at the top of my page that I want to link to the latest post in a certain category. I just need to get the post ID of the latest post in the category so I can pass it to the menu. I want to do this outside of the loop and create a function in functions.php that will return the post ID. Does anyone have any suggestions on how to do this?

Why does rewrite rule work for page not for custom post type post?

Update: I read that a custom rewrite rule might be overridden and drop any parameter variables, when the custom rewrite rule is used on a child/parent page/post. The post my custom rewrite rule is meant for, is not a child/parent but it is part of a custom post type. Could this be causing similar rewrite issues (dropped parameter variables)?