The Royal Navy had multiple ships named after foreign royalty or other dignitaries. There were 4 main sources of such names:
Famous figures from the past, an extension of the widespread use of names from myth to include real people. Examples include HMS Cleopatra, HMS Zenobia, and HMS Saladin (Saladin was an S-class destroyer, and they wanted yet another "S" name).
Ships captured from foreign navies, which often kept their names. If a French ship was named after a French dignitary, it often kept that name. Examples include HMS Duc de la Vauginon, HMS Duc de Chartres and HMS Marquis de Seignelay which were originally French privateers which kept their names when captured and put into RN service. A royalty-example is HMS Marie Antoinette, which began its career as a merchant schooner Marie Antoinette, and was requisitioned by the revolutionary French navy and (of course) renamed, becoming Convention Nationale. When she was captured by the British, she reverted to her original name for British service (perhaps to annoy the French?). It was an ignominious end for a ship with such a famous name, when her crew mutinied and handed her over to the French.
Ships which began as merchant or passenger ships could be named after foreign dignitaries, and often kept their names if they came in RN service. One example is HMS Vyner Brooke, formerly SS Vyner Brooke, both a merchant and the royal yacht of Sarawak, named after Sir Charles Vyner Brooke, 3rd Rajah of Sarawak (and sunk by Japanese air attack during the evacuation of Singapore). There are other candidates for VIP names among the commercial ships taken into British naval service in Asia at that time, such as HMS Fuh Wo, HMS Sin Aik Lee, HMS Kung Wo, and others (but, alas, I can't find details of who/what they were named after). Regardless of the origin of the name, HMS Li Wo deserves further mention, for the astonishing end of her career. Successfully escaping Singapore with only minor damage from air attack, she encountered a Japanese invasion fleet in Indonesia, and proceeded to attack the transports in the invasion convoy. She damaged one by shelling, and machine-gunned another. Fatally damaged herself, the former passenger boat from the upper Yangtze then rammed the damaged transport, sinking her. Only 7 of her crew survived to be captured (the Japanese machine-gunned the crew after they abandoned ship).
A few RN ships were simply named after foreigners, such as HMS Victor Emmanuel. She was built and commissioned as HMS Repulse, but renamed Victor Emmanuel and being visited by Victor Emmanuel II towards the end of her first year of service. The name change was at the request of Queen Victoria (perhaps in honour of his decision to join the Crimean War (still ongoing at the time) as an ally?). Another two ships were the WWI-built monitors HMS Marshal Ney and HMS Marshal Soult (after the war, Ney was renamed, but Soult appears to have kept her name).
So, in summary, the answer to your question
How common was it to name warships after foreign dignitaries or royalty?
is "not very", especially if ships that inherited such names from earlier foreign or commercial service are excluded. The 3 examples in the 4th category all appear to have their names due to wartime alliances.