A number of trains between Austrian towns e.g. Innsbruck and Salzburg. They go via Germany, often without stopping. A number of trains between Austria and Switzerland also pass through Lichtenstein non stop. May not have this quite right but believe trains from Serbia (Belgrade) to Montenegro (Bar) briefly pass through Bosnia non stop.
Re "often without stopping", I think it's actually very rare for
any "internal" Austrian train that uses the faster through-the-corner-of-Germany route between Salzburg and Worgl to ever serve any German stations. (Or indeed any international train through there such as Vienna-Zurich.)
All Austria-Switzerland services have to cross Lichtenstein, and as far as I remember,
none of the long-distance ones ever stops in Lichtenstein. [I did read recently of plans for a new frequent "local" service linking (I presume) Buchs (in Switzerland) and Feldkirch (in Austria), which would stop at a couple of places in Lichtenstein on the way.]
Yes, Serbia-Montenegro services do run through a corner of BiH (on which there are, I think, no stations to stop at anyway!). Though the BiH section isn't
between the other countries, but on part of the route otherwise within Serbia.
I wonder where there are any trains on the coastal route through the south of France which don't stop at Monaco on the way through??
The examples here where they fit the second of the two types listed at the beginning (ie A-B-A with no stop in B, rather than A-B-C with no stop in B) don't, despite the "eg" given in the original question, involve enclaves/exclaves. In fact I can't think of any European enclaves/exclaves with a rail connection...
As with the (not now running) Paris-Italy sleeper, I expect there might be some sleepers in eastern Europe which cut through a bit of a country without a scheduled stop. (Does the new Prague-Rijeka night train have stops in every country it goes through?)
Before the Baltic States got EU-ised, in the days when there was still a Tallinn-Riga-Vilnius route, some of those trains went on to Warsaw [Tallinn-Warsaw was slow, but useful!]; between Lithuania and Poland the route went through a corner of Belarus with no station stop - though there was a very lengthy middle-of-the-night stop at Grodno in Belarus for the bogies to be changed ... and for [in my experience] officious Belarusian border guards to falsely claim a need for passengers to have got a transit visa. I once had a stand-off (mostly a "sit-off", in fact) over this issue in a border guards' hut by the side of the tracks, which took up most of the time the train was there.
There are some other places where railway lines end up zig-zagging across borders without any station between the zig and the zag, generally (I think) where borders have moved. There's somewhere on the current German-Polish border like that.