Get post_type page with missing meta_key
$query = array(
'posts_per_page' => -1,
'post_type' => 'page',
'post_status' => 'publish',
'post_parent' => 'OPTIONAL_PAGE_PARENTID',
);
$query['meta_query'] = array();
$query['meta_query'][] = array(
'key' => 'KEYNAME',
'compare' => 'NOT EXISTS',
);
$posts = get_posts($query);
Get post_type post with missing meta_key
$query = array(
'posts_per_page' => -1,
'post_type' => 'post',
'post_status' => 'publish',
);
$query['meta_query'] = array();
$query['meta_query'][] = array(
'key' => 'KEYNAME',
'compare' => 'NOT EXISTS',
);
$posts = get_posts($query);