How to prevent a node from listing programmatically? How can I prevent a node from listing, programmatically? I want to select node by nid. Beacause of some reasons, I don't want to use hook_node_grants() and hook_node_access_records()

I tried to change the _node_access_where_sql() function in the core which creates where clause for use in fetching node listings but $node or $nid is not passed to the function so I can't select node by nid
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?