I don't think there will be any problem with the livery of older engines and/or rolling stock as they are generally solid colours with details like pinstriping, none of which is sufficiently original to qualify for copyright. And back in those days no-one thought of the livery of trains as being a form of trade dress which might be registered as a trade mark.
However when it comes to the trains of today, there are two aspects to consider: trade marks and copyright.
. The train operating companies spend huge amounts of money on branding which includes the train livery, and as a consequence they are more likely to register key elements of their branding as trade marks. I don't know of any specific livery which has been registered in this way, but as colours can be registered if they have enough acquired distinctiveness, I would be surprised if none had actually been registered. More obviously, logos, like for instance First Great Western's GW
R emblem*, will definitely be registered as trade marks. So on that basis I would advise you to ask for permission if you are in doubt when it comes to modern trains. Of course this only matters because you are planning on selling merchandise which will feature this branding. That means that you would be using these possible trade marks in the course of trade, which could be infringing. If you just want to make paintings for your own pleasure, you wouldn't need permission.
. When it comes to the graphic work in the livery of some the modern trains (like for instance the LNER Class 800 Azuma trains**) I think there is a much stronger argument that copyright will apply to these designs, because they probably meet the originality criterion for artistic works. So on that basis, again, asking for permission may save you a lot of hassle. I say this despite the fact that there is a reasonably strong argument which says that since depicting a train in a photograph or painting is perfectly lawful, the mere presence of any protected livery artwork in the picture would fall under the exception for incidental inclusion (permitted under section 31
CDPA). I know of no photographer being pursued by a train operating company for taking pictures of their trains!
* The actual logo can be found here.
** As shown in this photograph by provided under a Creative Commons Attribution licence by Mynewsdesk.com/Hitachirail.com