This might require writing custom sql with a subquery:
$results = $wpdb->get_results("
SELECT *
FROM $wpdb->posts
WHERE ID NOT IN (
SELECT post_id FROM $wpdb->postmeta
WHERE meta_key = 'my_custom_field' and meta_value = 2
)
");
then just iterate through the results as described here.