Spain should have said it doesn't recognize the election under the conditions it was run.  Instead, its shotgun marriage approach doesn't leave Catalan secessionists with much in the way of peaceful options.

If the EU was smart, it would lay out a standard path to succession within a member nation and from the EU.  A census followed by election by 50%+1 of eligible voters (not votes cast) would be achievable if the region had a strong consensus, but not easy enough to do it on a whim.