Your daughter's problems are more likely than not - NOT a physical problem. When children are "holding" their body functions, it is their way of exerting control over their lives. They - when you think about it - have no control over anything you do, i.e., their schedules - plans you make for them, etc... they do, however, have control over their bodies. Example...let's say it is breakfast time - you are all running a bit late - she wants to eat breakfast - you say "we have to go"....etc. She can not control anything that is happening to her...BUT when you are ready to walk out the door or get in the car...suddenly she has to poop/pee... voila' she has control...she gets a say in what is happening to her. (This is very well documented in Freudian teachings) She can control her environment, by controling her evacuations.
By concentrating on "fixing" her - you are just battling to take away the only "control" she feels she has over her little life. You, in turn, make it worse... Over time, all this will take a toll on her physically, emotionally and mentally. You have to let go... (Yes, hard for a loving mother I know).
There is a book (and I know you will wonder why I'm recommending this, but trust me here...) by Abby Rohrer - called "Why won't my child stop pulling their hair out..?". She is a wonderful lady and her daughter had exactly the same problem as yours... It wasn't until she addressed her own issue, that her daughter was helped as well. Our children react to everything we do - even if we think we are hiding it from them. If you want - I can send you some of the book - (the part about her daughter)...
I wish you the best :) My heart is with you.
Sandi