A company that is not resident in the UK will only be subject to UK corporation tax if it carries on a trade in the UK through a permanent establishment. Where it does so, it will be subject to UK corporation tax on all profits that are attributable to the UK permanent establishment. There is an exception to this rule for any person dealing in and developing UK land - see the Transactions in UK land guidance note for further information. CTA 2009, s 5(2)
This guidance note outlines when an overseas company will have a permanent establishment in the UK and how to calculate the profits attributable to that permanent establishment.
The same principles may apply when determining whether a UK company has a permanent establishment in another country.
In any case, where a double tax treaty is in place, this will typically provide that a UK company is only subject to tax in another country if it has a permanent establishment there. Most of the UK's double tax treaties follow the OECD model tax treaty and the definition of permanent establishment is therefore the same as the UK definition.