This question is off-topic because your is a simple PHP error, not related to WordPress.
You are trying to check if a variable is empty using:
if ( $meta != $empty ) {
but this is not the right way, in fact this code compare the target variable $meta
with another variable $empty
that is not defined.
If you want to check if a variable is empty in PHP you have to use the empty
function so your code should be:
<?php
$postid = get_queried_object_id();
$meta = get_post_meta($postid, 'codigopostal', true);
if ( ! empty($meta) ) echo "(" . $meta . ")";
?>
Note I’ve used get_queried_object_id
that return the id of the current queried post id without using global variables.