"на" refers to territory, "в" refers to state. The distinction is clear. One exception: "Ukraine". Traditionally, Ukraine was referred with "на" in Russian language and it never meant disrespect. But since a few years ago my fellow Ukrainians decided that this is now offensive and so here we are, fighting words.