A Dm's Gut Call...
I would say no (And sorry for the pun). But such a thing has never come up before, so lets check the rules.
To swallow an opponent, a purple worm has to use use its Improved grab ability with its bite attack. Improved grab is an easy way to start a grapple. On page 138 of the PHB, under the grappling consequnces heading, it states the following;
Grappling Consequences
While your grappling, your ability to attack others and defend yourself is limited.
No Threatened Area: You don't threaten any area while grappling.
No Dexterity Bonus: You lose your Dexterity bonus to AC (if you have one) against opponents you arent grappling. (You can still use it against opponents you are grappling.)
If you dont lose your dexterity bonus against an opponent you are grappling, then I see no reason for a worm, dragon, etc, to lose its Dex bonus against its lunch. And in the unusual case of a swallow ability from a grapple, I would rule that the creature is not considered to be grappling its swallowed opponent.
To sum up: A Rogue involved in a grapple cannot score sneak attacks as a result of the grapple.
END COMMUNICATION