The easiest place to look that up is in EU law. The Schengen Border Code says that Heads of State and other dignitaries do not get an entry stamp (art. 10(3)(a)), but when it comes to border checks the only exception is for a Head of State and his delegation (Annex VII, par. 1). They are not subject to border checks. The best the SBC has on offer for VIPs travelling without a Head of State is priority check-in:
4.1. In view of the special privileges or immunities they enjoy, the holders of diplomatic, official or service passports issued by third countries or their Governments recognised by the Member States, as well as the holders of documents issued by the international organisations listed in point 4.4 who are travelling in the course of their duties, may be given priority over other travellers at border crossing points even though they remain, where applicable, subject to the requirement for a visa.When it comes to visas, there is a special regulation, Regulation 539/2001. Regarding diplomatic VIPs, it says:
Article 4Operative word: may.
1. A Member State may provide for exceptions from the visa requirement provided for by Article 1(1) or from the exemption from the visa requirement provided for by Article 1(2) as regards:
(a) holders of diplomatic passports, official-duty passports and other official passports;
Now we might speculate that a continent that is as committed to the fostering of international relations as Europe (cf. art. 90 of the Dutch Constitution: "The Government shall promote the development of the international rule of law.") will generally provide for such visa exemptions. But clearly, according to the European legislator, there is no rule of international law that requires them to do so. Clearly, the fact that sovereign immunity extends to a travelling prime minister (cf. ICJ in Congo v. Belgium) does not mean that he also has to be able to enter the country.
For the US, the relevant law is - with characteristic brevity - in 22 CFR 41.26, which discusses who gets to have a diplomatic visa. Note that they even include Heads of State.