No, there is no way to prevent duplicates. Sometimes I have gotten rid of them by removing one ad unit from the pages, which in theory increases the competition for the space. But there's no guarantees.
Who says they will turn off all Google ads on your site? Google's the one serving the ads, and the publishers have little control, so I can't see how Google would tell you that. Are you sure the warning means what you think it means?
Per example, if I have 3 slots on some webpage, I create 3 diff ad codes, one for each slot. I don't repeat the ad codes. Still I get sometimes repeated ads but, I'm using diff code on diff slots. I supposed that was the way everybody was doing things. Could they be talking about using repetitive ad code?
The same 3 ad codes or different 3 ad codes on the same page do not matter. They are fine. The OPs problem is different - his site code conflicts with adsense's code, which the robot detects as double-serving.