This market resolves to “yes” if Scotland either votes to leave in a referendum or actually does leave the UK through some other means before January 1st 2040.
It resolves “No” if Scotland does not leave or vote to leave.
It resolves “n/a” if Scotland ceases to exist or is annexed by some country or organisation from outside the UK. Choosing to join the EU does not count as “annexation” for this purpose.
I guess in that case it depends on how the international community sees it. If the EU, USA and similar treat Scotland as if it is independent then “yes”, otherwise “no”.
Update: I’ve decided that the check for this will be whether or not Scotland has a separate seat to the UK at the UN.
@DaisyWelham the UN's procedures can surprise, and I'm not an expert, but it appears that the UK has a veto on UN membership for new states: