If a people desire freedom you have two options:

1. Give it to them.

2. Violently suppress the separatists.

Spain has opted for option 2 prematurely, the referendum turnout was low, below 50%, and it's by no means clear that a majority of people in Catalonia want Independence. The low turnout gave Spain some wiggle room, but by sending in paramilitaries to drag people out of polling stations they lost that wiggle room.

An Independent Catalan Republic is now almost inevitable within five years.

That's extremely awkward for the EU in the middle of Brexit because the number and size of the EU states might not be the same in twelve months and if Spain can't hold onto Catalonia it can't claim Gibraltar.