I did not get the time to test it yet. But it should be working. The idea is to save the post ids and post types in wp_options. Then you can get those values and save them in an array. After that you compare them with current post and do the action that you want. You can put this in functions.php
function sr_excluded_users()
{
global $post;
global $wp_query;
$exclusive_post_ids = array(); // List of post ids ( you can store it in wp options )
$exclusive_post_types = array(); // List of custom post types ( you can store it in wp options )
if( in_array( $post->ID, $exclusive_post_ids ) && in_array( $post->post_type, $exclusive_post_types ) )
{
$wp_query->set_404();
status_header( 404 );
get_template_part( 404 );
exit();
}
}
add_action( 'wp', 'sr_excluded_users' );
Edit : Function to remove posts from loop
function sr_excluded_users_loop($query)
{
$exclusive_post_ids = array(); // List of post ids ( you can store it in wp options )
$query->set( 'post__not_in' , $exclusive_post_ids );
}
add_action( 'pre_get_posts', 'sr_excluded_users_loop' );