A Rogue has been swallowed whole, is being crushed by the beasts stomach muscles, and melted by it's stomach acids. The Rogue either has little to no space to move in, (thus losing his Dexterity bonus to AC and such, as he is considered grappled while in the stomach), and you think he can calmly and precisely place his attacks in order to get Sneak Attack damage?
Actually, yes. To me, that situation is not different enough from other situations where the rogue is not denied his ability to sneak attack.
Let's see if we can come up with a similar situation where the rogue is not inside a stomach to serve as an example of what I mean. Let's say the rogue has blindsight and tremorsense (to avoid problems of not being able to see). Let's say that said rogue is on the floor of a pit of acid (A.K.A. - immersed in acid) and is being grappled by tentacles from some creature immune to acid. Now let's also say that there is another creature in the same space as the rogue who is blind. The rogue in such a situation according to the rules ought to get sneak attack against that blind opponent. He can attack that opponent as said opponent is in the same square and the rogue is effectively invisible to the blind opponent thereby denying dex. Sure, the situation is crazy and the rogue has to worry about being dissolved in the acid, has to worry about the grappling tentacle etc. But it does not mean that the rogue cannot gain advantage of his abilities.
Because a fighter in the same position would make exactly the same moves to get out?
That is about the only reason I can think of that makes my opinion messy. Afterall, why wouldn't everyone get the equivalent of SA if they were in the same situatioin. About the only justification I can give, is to look at the situation as any other. Rogue is considered invisible so he get's sneak attack. After all, a fighter can certainly discern the vital organs of a human but doesn't get sneak attack (although, that is a pretty weak counterargument). But it really is as simple as invisible means opponent denied dex means sneak attack.
Really, the answers have been given: if you don't like it because the justification for them isn't good enough in your opinion, go ahead and house rule it. beware the fact that the rogue will from now on go and jump in like Tommy Lee jones in Men in Black.
Unless you have a quote from official errata (presuming Dragon is not official errata - that I don't know for sure) the answer that has been given is not official. However, even if it is, rules wise it is inconsistent (hmm, certainly not the first time that has happened).
I concede that in reality it does not make much sense that the rogue would be able to sneak attack assuming that sneak attack requires the concentration and precision that has been noted before. But I am arguing from a purely rules based perspective. According to the rules we have the following information:
Rogue is invisible to senses of the worm.
An invisible character denies their opponent his or her dex unless the opponent has uncanny dodge.
Rogue does not threaten an area beyond his own square.
His opponent (or part of the stomach anyway) is in his own square.
Rules say, rogue gets sneak attack. Sure makes about as much sense as a evasion, but that is another issue.