Only out of spite, though. If Catalonia were to be independent, Spain would gain from it joining the EU.
Their commitment to keeping them out of the EU is there to deter them from leaving Spain in the first place, which likely would be bad for Spain.
Spain is working much harder to make a believable deterrent than other "countries with separatism". You don't have France, Denmark or the UK refusing to recognize Kosovo, for example.