Thanks, I was just about to improve the answer
–
bungesheaDec 6 '12 at 23:00

I tried your code, but nothing's appearing where that function and return is. Am I missing something? I just have a file named 404.php in my theme directory. I would like it to redirect to this page so it includes File Not Found in the title element, body, etc.
–
user1462Dec 6 '12 at 23:02

I've updated my original code example above. It just checks if a variable is false and if so, should send the user to the 404. Sorry for the confusion about being logged in or not.
–
user1462Dec 6 '12 at 23:06