It could be umpire fault. We tell the coaches to have their players line up all bats and helmets that are going to be used in the game on the fence prior to the game for inspection. Maybe the umpire didn't do that, or the player snuck it in.Or, like TMIB mentioned, when a previous infraction either went unpunished or incorrectly punished. But then, it would be both the coach and the blue that didn't know the rule.
Best bet, if you know it's illegal, or you're not sure, deal with it pregame and remove the doubt. Then let the player and her parents know that she can't use it in those types of games.
The stupid thing is when these kids have the correct bat IN THEIR BAG, but chose to use the illegal bat because they like it better (and they didn't get caught last time).