Chain rubs against frame when in smallest rear cog I've set up a 12-speed SRAM Force groupset with an XDR cassette. When in the smallest rear cog, the chain rubs against the frame: 
Does anyone know what causes this and how to fix it?
The frame is a Dolan Titanium ADX and the wheels have QR axles.
Sometimes things like this happen when newer generation components are put on older frames. When Campy 10 first came out, I remember some frames doing it. However, that was usually from hitting the end of a chainstay or seatstay that wasn't offset flat enough with the inside face of the dropout.
Your picture shows the chain rubbing against the flat surface of the dropout, or what would normally be made as a flat surface, which is odd. Three things that come to mind are the dropout is trying to be flat but isn't, the locknut contact area got worn down or made badly somehow, or the hub and/or cassette is put together wrong. Those are the first things to check.
There are QR and thru axle versions of the frame, and you don't say which you have. There's no QR nut visible AFAIC so I'll assume thru.
It's not clear from the image whether knocking down the relevant dropout surfaces a bit would do it, but that could be one approach. I would let a ti framebuilder or the manufacturer evaluate that unless you're feeling daring. There's also the notion of slightly building up the axle contact surfaces (you'd want to do it symmetrically), i.e. if it were a QR frame and you were okay with the judgment call of increasing the OLD by the needed amount, probably like 1mm total, you could bond in some .5mm ground stainless round M10 shims and then trim them down once set to become part of the dropout. Doing the same would likely not be as straightforward with a thru axle, and you can't easily check the dropout alignment before you start, which is not ideal, but it may be possible.
Edit in response to comment:
Personally, the first thing I would do to evaluate a solution based on adding a spacer or spacers is measure the current rear end spacing and the dropout alignment. While at it you could get an exact measure of the hub OLD, which is less relevant because wheels get switched, but you may have an idea of how long/often it's going to be run with the wheel you've got.
Adding spacer(s) and then putting the wheel back in splays open the frame. What happens when you close the QR is it then squashes the dropouts and axle together to be in line anyway. This creates flexion (I think I'm using the term right) in the dropouts and/or axle. Depending on how stiff, strong, and ductile those parts are, the result can be fatigue cracking in the dropout or axle, or flex in the axle that can cause bearing misalignment and resultant drag, or harmless flex in the dropouts.
A lot bikes in the world have, for example, thin dropouts made of a high-ductility steel like 1020, which is fancy talk for melted Chevys. Do something like this on a bike like that and the dropouts will flex to accommodate and you'll almost certainly never see an ill effect. A recent ti frame with what look like thick dropouts, plus presumably some kind of modern, stiff, oversized aluminum axle will be different. I'd be more concerned about fatigue failure in the dropouts. And if you do wind up with axle flex, that can be pretty bad too.
That is not all to say it couldn't be reasonable under any circumstance. But you need to judge it in light of the existing spacing and dropout alignment as well as how much gap you intend to add. It's common for spacing and dropout alignment to be imperfect as-is. So you want to know it if for example you're taking the dropout alignment in the direction you'll be adding splay from iffy to worse or perfect to iffy or whatever. And same with the spacing. Say it happens to be 136mm with perfect dropout alignment now; if you add 1mm you're actually making it better, because you're presently adding the same sort of misalignment and flex in reverse when you clamp down on your 135. (I'm assuming it's a 135 rear end, substitute 131 and 130 for the above numbers if not.) But if it were 133 with perfect dropout alignment now, the 1mm added means something different. The point is that the state it's in now is really what the whole conversation is about in terms of whether this is a good idea.
Note that driveside dropouts or dropout-chainstay connections are a major place that frames naturally fatigue out even if everything about their construction is great.
As for what to actually do, I, again personally, would never add a free-floating spacer there. Yes it could be a way to make the bike physically work. To me it would feel like janking up a nice bike. It would also feel like janking up a nice bike to only add a drive side spacer and thus either accept the wheel being misaligned in the frame or having to run a wheel that's custom-dished for the frame in the direction that gives up non-drive-side spoke tension. But say you get your M10 ground SS 0.5mm round shims and determine that one is all it takes, which appears likely. There are spacing and dropout alignment situations where bonding on one per side could then be either totally fine or a compromise that never amounts to anything. You could then test before doing it by putting them on and penduluming the wheel with the chain disconnected, and getting a feel for what's happening with the dropouts by tactile observation when you close the QR. (What I found doing this would inform by answer to the question of whether I'd do it if the dropout alignment and spacing were both perfect.)
I would personally be far more curious about first seeing if a ti builder might be into knocking down the rubby areas with a dynafile or whatever.