Do not show a custom post if it belongs to a certain custom taxonomy

You are not going to be able to prevent anyone from ever loading that page. Even if there is no link to it, you probably have a sitemap generated that creates links to all items. So wanting to block it is the right thing to do but changing the query to try and do it is not.

Probably the best and easiest approach is to use loop templates in your single.php. If you have loop-single.php (for legitimate items) and then loop-disallow.php (for the ones you do not want used), then the following code would help:

$template="single";
if(<in taxonomy logic here>) $template="disallow";
get_template_part('loop', $template);

Then for your disallow loop, you can just display an Item Not Found or something along those lines. You could also consider adding logic to the header to issue a 404 when one of these pages are hit.

— UPDATE —

If you want to do this in a plugin, it is actually a fairly simple process. You can create a filter on the_content that only changes the content when your taxonomy is encountered.

Another approach would be to simply force a 404 when the taxonomy is detected on a single page using:

include( get_query_template( '404' ) );

You would have to experiment about the best place to put this and you may need some other code (an exit call perhaps – which scares me!) to make sure the normal template doesn’t load after the 404.