It would be a matter for discussion.
When the Soviet Union broke up, Russia accepted the full foreign debt of the Soviet Union. This was restructured by the "Paris Club", and left Russia with a debt of about $60 billion.
On the other hand, when Czechoslovakia split, the national property and national debt were shared, roughly in the ratio 2:1. This was a result of negotiations between the administrations of the two countries.
There is no "one size fits all" answer to this question. The division of a state's assets and debts is a matter for the countries concerned, and their creditors. There are several possibilities.
- The successor states agree to share the debts equally or according to some formula. This is possible if the separation is friendly.
- One state agrees to accept all the debt. This is possible if one of the states is significantly larger and wants to be seen as the successor state.
- One or all of the successor states refuse to accept the debt, and creditors then judge that a default has occurred. This is most likely if the separation is disputed or chaotic. Croatia was judged to be in default from '93 to '96 following and during the Yugoslav wars.
What would happen in a specific case would depend on the nature of the separation, and the skill of the negotiators (or strength of the soldiers)
Spain has shown no sign of being willing to enter negotiations on a secession for Catalonia. In the unlikely event of a violent separation, Catalonia would not automatically inherit the debt, and creditors would look to Spain, to pay its debt. Failure of Spain to pay would be a default. As noted, this is not a likely scenario.