I do sympathise. This happened with dd.
First thing, don't beat yourself up about the diet thing. Dd had an excellent diet, lots of fruit and veg, plenty of liquids, and she retained her poo. If they are going to do it, they will do it.
See your gp and ask for extra help. I remember crying with the practice nurse as I was so wound up at the whole thing.
Mt HV eventually told me that she felt that dd was doing it as an attention seaking thing. I would ignore tantrums, never worried about what she ate, so this was soemthing that she could do that was forcing me to react. It was a control issue, if you like.
On the positive side, it went away, around the time of her being potty trained. She is now a healty 7 year old with normal bowel movements!
I can't give you a 'do this and it will go away' bit of advice, I wish that I could because I do remember how awful it was. Only thing that I would say is try not to concentrate on it too much, impossible I know. And accentuate the positive, rewards etc when she does poo, but low key stuff, no start charts as they re-informce the behaviour you dont want, but making more of an issue of the thing.
Hope things get better soon.