The simple answer is 'No' - if Scotland and Northern Ireland were to remain within the single market and customs union, they could not simultaneously be within the UK economic union.
In the aftermath of the referendum vote, there was much support in Scotland and Northern Ireland for a ‘soft Brexit’, which would keep the whole of the UK in the Single Market, albeit outside the EU. As opinion in Westminster consolidates around ‘hard Brexit’, there is talk of keeping Scotland and Northern Ireland, at least, within the single market and even the customs union, while England and Wales remain outside. In Scotland, the motive is to enjoy free trade and free movement and find a ‘third way’ which might avoid an independence referendum in the short term. In Northern Ireland, it is to avoid a ‘hard border’ with the Republic of Ireland. In practice the opportunities for doing this are scarce.
The single market involves the removal of barriers to the free movement of goods, services, capital and workers. This includes harmonization of product standards, or mutual recognition so that products meeting home standards are deemed to have met the standard everywhere in the EU. The four freedoms of the single market are deemed to be inseparable in order to ensure a level playing field. Freedom of movement of workers is also important in facilitating free movement in services. There are also rules about state aid, competition, public procurement and other fields.
The EU is also a customs union, in which not only are tariffs between the member states abolished, but there is a common external tariff. This means that goods imported into any state of the union can then circulate freely without further controls. That includes raw materials and components that are imported from third countries and used in the assembly of finished products, which are then exported to other member countries. Member states of a customs union cannot negotiate their own trade deals with third countries, since there can only be one tariff regime. The European Economic Area (consisting of the EU plus Norway, Iceland and Lichtenstein) is a single market but not a customs union. This means products assembled in the three EEA countries from raw materials and components coming from outside the EEA, which are then exported on to other EEA states (including the EU), are subject to rules of origin. Rules of origin determine how much of the product was made within the EEA and how much imported, to decide what tariffs are due. Applying these rules is costly to business and governments, and requires the scrutiny of trade.
All of this means that, if Scotland and Northern Ireland were to remain within the single market and customs union, they could not simultaneously be within the UK economic union. There would be a hard economic border between them and England and Wales; to do otherwise would create a gap in both economic unions through which goods, services and people could flow uncontrolled. Such tariffs as would apply to trade between the UK and Europe would apply to trade between the rest of the UK and the two devolved territories. If Scottish and Northern Irish firms could export services freely around Europe, they could not do so with the rest of the UK as long as it was outside the single market. If Scotland and Northern Ireland were within the customs union, then trade with England and Wales would be subject to rules of origin and customs checks to ensure that the appropriate duties had been paid. The only precedent I can find in Western Europe is the Basque system before 1820, allowing the Basque provinces free trade with the world but imposing tariffs on trade with the rest of Spain.
Even were it economically viable, such as system would not be acceptable either to the UK or to the European Union. For Scotland, it would almost amount to independence, raising the question of why it did not just go the whole way. In Northern Ireland, barriers with the rest of the UK would be unacceptable to the unionist community and undermine agreement about consensus being needed for a change in the status of the province.
There is one issue on which compromise might be possible and that is free movement of people between the two parts of Ireland. The UK and Ireland could sign a bilateral agreement allowing free movement and rights to work for citizens of their respective countries, based on the longstanding Common Travel Area and other provisions. It would not allow free movement of European citizens in and out of Northern Ireland. Nor would it have any relevance for a non-independent Scotland, where free movement across the border with England is not at issue. It might be useful in an independent Scotland, to maintain a free flow of people with both the UK and Europe.
So there are ways in which the Irish border could be kept open for people, but not for goods and services. Even were it economically practical, the Republic of Ireland has no power to negotiate free trade with other countries. That is the responsibility of the European Union as the customs union. Even were some ingenious way found to allow goods and services to be traded tariff-free between the two parts of Ireland, rules of origin and checks would be required to ensure that the provision was not being used as a back-door for firms in the rest of the UK to use Ireland as a backdoor into the single market. There are strong political reasons to find an intermediate solution in Scotland and to keep the Irish border open. There is a feeling that, since the UK has a flexible constitution and we have managed to muddle through in the past, something will be found. So far, however, nothing has been.
Michael Keating is Professor of Politics at the University of Aberdeen, Director of the Centre on Constitutional Change and Senior Fellow in the UK in a Changing Europe programme.