Why don’t you just collect the post_ID on the private posts in an array like this:
$res = $wpdb->get_results(“SELECT ID FROM $tableposts WHERE status = ‘private”);
if(have_posts(): while(have_posts(): the_post()){
if(!in_array(the_id(), $res->ID){
//do your stuff
}
}
…
Or similar…