The following will do that.
You need to replace XX and YY with the actual ids of the categories you want to hide.
<?php
foreach((get_the_category()) as $cat) {
if ($cat->cat_ID != “19” && $cat->cat_ID != “XX” && $cat->cat_ID != “YY”) {
echo ‘cat_ID . ‘”>’ .
$cat->cat_name . ‘, ‘;
}
}
?>
Only change here:
if ($cat->cat_ID != “19” && $cat->cat_ID != “XX” && $cat->cat_ID != “YY”)