This is very common. My son did this for several months. It turned out that he was scared of the big potty, kept thinking that he was going to fall in, and the training potty was to small, he thought it would 'touch him'. I bought a different training potty and moved it to just outside the bathroom. We he would go in his pants, he always would sneak off to a corner somewhere and get real quiet. When you asked if he had to go he'd say no. Then he say YES!, but I can' get there. We'd have to pick him up and make mad dashes to the bathroom. Didn't always make it.
You need to be firm in letting her know that going in her pants is not correct, but not be punishing or you'll make her afraid and create a whole other set of issues.
I got upset at my son once in a bathroom with an automatic flushing toilet for messing his pants. He got scared, moved and the toilet flushed while he was still on it. To this day, and he'll soon be 7, he will not use an automatic flushing toilet unless you hold you hand over the sensor.
One idea is to create a rewards/consequences chart. If she goes in the potty she gets dessert and a star. If she doesn't she doesn't get dessert and a star, etc. If she gets 7 stars, she can do something special..go to Chuck E. Cheese, have a playdate, go to the playground.. something simple and special.