How to prevent a node from listing programmatically?
Have you tried simply unpublishing the node with Rules? Rules will allow you to programmatically unpublish content based on a variety of factors. Once unpublished, Drupal will not list the node in content with the exception of Views that are not set to only display published content.

What are you using to determine which nodes should be processed by your code?