Local variables cannot be used in RAW, but it is possible to use scripting variables:
SELECT … FOR XML RAW($(x))
These variables are specified in command line of SQLCMD utility:
SQLCMD -v x="'abc'" …,
which results in RAW('abc').
IntelliSense accepts such constructs if you enable the “SQLCMD Mode” in Query menu.
Maybe TEXT_LEX means such kind of indirect text lexemes.