Sneak attack when an ally has been swallowed?

Our delightful barbarian decided to get swallowed by a Behir, Our scout rogue decided to stick an arrow in the unfortunate beast and claimed sneak attack as the barbarian was restrained but not incapacitated and technically inside the behir’s stomach is within 5 feet of it. Our DM said no chance after we couldnt find a ruling. Any thoughts would be greatly appreciated.