I think the real problem is that Spain have consistently blocked a peaceful referendum. I don't believe Catalonia would vote to leave in a fair vote, but I do feel that the repressive actions of the Kingdom of Spain on this matter are the kind of thing that could justify declaring independence unilaterally.
Denying people a right that's commonly understood to be fundamental to international law and then using violence to enforce it is repression in my book. Spain has consistently escalated tensions rather than offering a path to a real democratic decision. They're going to have to accept the repercussions of that decision.
Most importantly: the referendum is illegal even by the autonomic law of Catalonia. They should have had 2/3 of the chamber to push it, and they did it with less than half (48% IRCC).