Sorry for the repeated posts. Here is a proposed patch to be applied to the file “wp-includes/query.php” at line 1042. Entire if statement at that line should be replaced with the if statement below:
if ( !empty($q['category__not_in']) ) {
$cat_string= "'" . implode("', '", $q['category__not_in']) . "'";
$whichcat .= " AND $wpdb->posts.ID NOT IN (select $wpdb->term_relationships.object_id from $wpdb->term_relationships where $wpdb->term_relationships.term_taxonomy_id in ($cat_string) )";
}