I feel your pain!! We went through the exact same thing with my son and we have just recently resolved the problem...I think/hope!!! It took us many visits to the doctor and we got the same response as you. Potty training was a nightmare for us because our son was so dramatized by the very thought of going to the bathroom and having a hard BM that he would physically fight us when we took him. I know every child is different but here is what finally worked for us (BTW this was all OK'd with our doc first)
1-Fleet Enema for children. I know it's unpleasant but give him the fleet and put him in a diaper not underwear. This will "clean out any of the hard stool stuck in there) The reason for the diaper is so he doesn't associates the discomfort and unpleasantness of the enema process with going on the actual potty.
2- Miralax and Benefiber EVERY day. (Your doc can give you the correct dosage but we had to tweak the dosage a few times to get it just right)
3- Lot's of fiber rich foods and avoid things like cheese, milk etc.
4-Prizes for going #2 on the potty. We used a prize box filled with small little treats for him going.
I hope some of this info helps you!