You can try to use the template_redirect
hook to check your conditions and then set the wp_query->is_404
variable, like below:
function wpse202198_set_404(){
global $post;
global $wp_query;
if( $post->ID == PAGE_ID_OF_PROTECTED_PAGE ){
$wp_query->is_404 = true;
return;
}
}
add_action( 'template_redirect', 'wpse202198_set_404' );