The odds of Scotland being allowed into the EU as an independent nation are pretty slim. Spain is likely to veto their application in order to keep Catalonia and the Basque country from getting any ideas.
I doubt Spain will block Scotland's application, if there's no dispute between the Scottish and UK Governments regarding the sovereignty of Scotland. I could understand Spain blocking Scotland in the event of a unilateral deceleration of independence - as they still don't recognise Kosovo as an independent country, because of a UDI.
Although, I think Rajoy would be much more likely to block Scotland's EU application than anyone in PSOE or Podemos.