Replace "eq" with "neq"
Current condition tells to display the category when the category id equals to the XXX.
If you put "neq" this will mean display when the category id not equal to the XXX, thus will display everything except the XXX
{if $categories[cat_num].categoryid neq XXX} ... {/if}
will display all categories but XXX
{if $categories[cat_num].categoryid == XXX || $categories[cat_num].categoryid == YYY} ... {/if}
will display only categories XXX and YYY
there is more on smarty conditions here:
http://www.smarty.net/manual/en/language.function.if.php