Most sensible here is probably just a custom query
global $wpdb;
$sql_find_meta =
"SELECT post_id
FROM database_name_here.wp_postmeta
WHERE meta_key = 'my_special_value'
AND meta_value > '';"; // > '' == not null, whitespace or blank
$posts_with_meta_key = $wpdb->get_col( $sql_find_meta );
foreach ( $posts_with_meta_key as etc.....
You can repeat this for wp_termmeta
and term_id