As far as I recall, Spain's position is that they wouldn't veto Scotland joining, so long as the indy ref is mutually agreed by both Edinburgh and London, as it was last time around. But if Scotland tried to leave the UK against Westminster's will, they would never get into the EU.
Spain can adopt that stance because they know they never need feel under real pressure to grant the Catalans a referendum, since technically to do so would require a change to the Constitution. Which in turn requires supermajorities (two thirds, I think - Catch 66.6 recurring) in both houses, confirmed by a nationwide referendum across all of Spain, and then again by a newly convened parliament.