There were quite a lot in steam days. Even confining it to the BR period there were around 45 duplicated names (90 locos) but the names sometimes had different meanings. For example SR Schools class 30902 Wellington referred, not surprisingly, to the public school, whereas the same name on GWR Castle 5075 referred to the fighter plane. Merlin was the bird on A4 60027 and the magician on King Arthur 30740.
There were four locos named Prince of Wales in service at the same time - Vale of Rheidol tank no. 9, GWR Star 4041, A3 60054 and D11 62662. Then you have the same name with different spellings, for example Owen Glendower on Britannia 70010 and Owain Glyndŵr on Vale of Rheidol tank no. 7.
I admit to having a list of these ready just in case anyone asks!