At 3, she should be able to explain to you (in elementary terms) WHY she does this. Don't ask her why she DOESN' to poop in the potty, ask her why she WANTS to poop in her pants (do this sometime when you're feeling cuddly and snuggly, not w/you standing over her shaking your finger in her face -- if you can picture the difference! I'd be the one shaking the finger, so I had to throw that in just in case you're like me, which I SERIOUSLY doubt. LOL) Anyway, if she can't come up with anything on her own after a minute or so, start giving her 'multiple choice' answers -- one at a time:
Does it hurt when you poop?
Do you like the feel of it in your pants?
Do you like the mess it leaves in your pants?
Do you not want anyone to see you when you poop?
Are you afraid of the water splashing on you? (if she's using an adult commode or if she ever HAS used one).
Do you like to keep the poop with you?
And any other question representing what you suspect might be true.
If you can get any clue, try to explain it away or prove it differently.
Now, surely she has a general timeframe each day that she 'goes' (after lunch or dinner, after her nap, or whatever). When it gets anywhere near that time, say, "We're going to potty now". Pour hot 1/2" or so of hot water in her little potty (if she uses one. The moist heat helps relax the sphincter muscles in one's bottom), sit her on it, and do something she loves (shape sorter, learning colors, reading a book). Sit in there with her (you can 'go potty', too if possible) and stay however long it takes to get the poop out. If you want to guarantee success a little more strongly, use a glycerin suppository (or half of one. A whole one is rarely needed). When she 'goes', make a big deal of it with a little chant, cheer, or song and dance (or all of the above)! Tell her 'THAT'S what I'm talkin' about!'
I raised 4 kids and have 4 grandchildren who I've helped with. I love potty training, and my own kids were all completely trained by their 2nd birthday. It doesn't hamper them, it enables them. I really frown on this modern attitude of 'they'll do it when they're ready, don't push them'. Oh, and they'll take over the household when they're ready, and many do -- as toddlers, even (just watch Nanny 911 or Supernanny)! That's human nature. I wasn't able to teach my kids self-discipline in many other areas (because I'm 52 and am still terribly undisciplined, myself), but potty training is one area for which I get a 'gold star' on my chart! LOL
God bless and hope this helps!