$posts_query = new WP_Query( array( 'tax_query' => array( array( 'taxonomy' => 'foo', 'operator' => 'NOT EXISTS', // or 'EXISTS' ), ), ) );