That is why the UK has to stay in the Shenghen - which completely undermines their reasons for leaving, otherwise there is going to be an explosion in Ireland. Sinn Fein wants unification but there are enough Protestants in the north that that isn't likely.
What is interesting as well is Scotland has said that they are exploring their options on staying in the EU or keeping strong relationships with the EU regardless of what the rest of the UK does. Considering it would take a few years to organise another referendum it would be very interesting to see if they could negotiate some sort of free trade zone where part of the UK is nominally EU and the rest is not.
In the far east along the Amur river there are free trade areas between Russia and China where nationals of either countries can cross without visa to trade. So they are cities with kind of a special status, I'm sure there are other such places around the world. Having Scotland as a part of the EU and the UK could be an acceptable compromise for everyone. Much like how Greenland is part of Denmark but not the EU