You have a choice of whether to keep the flat or sell it. Assuming you want to keep it...
Assuming similar interest rates, you should pay off your wife's mortgage first. You get very little tax relief on your home but you will be able to set 75% of the interest paid on your investment property against the rent received. So it's far more tax efficient.
If one, or both, of the loans is on a very cheap tracker, you probably should not pay it off as there may well be some incentive to do so at a later stage.
You will need to do some formal agreement with your wife about how your assets are split if things go wrong. If you pay off your wife's mortgage and you split up, you will be left with a mortgage on your property and she will have a much reduced mortgage. Of course, if you pay off your own mortgage instead, you will be left mortgage free and she will still have her mortgage.
Brendan