When is it OK to drink them? Easy to remember answer: Never.
The problem is not that it's "never" okay to have a sugary drink, the problem is that it's a part of many people's everyday diet. A sugary drink should be a treat - something you have every once in a while not for legitimate sustenance, but to taste something (which to some people may be) pleasant.
Life is short, and none of us are getting out alive. A root beer every now and then may be better for the soul than it is bad for the kidneys.
It is much easier to suggest solutions when you know nothing about the problem.