'Rhaid i fi beidio' = I must not (ie I am prohibited from doing)
'Does dim rhaid i fi' = I don't have to (There is no necessity for me to)
These are different sentences.
eg:- Rhaid i beidio ag yfed = I must not drink (It is necessary for me not to drink)
Does dim rhaid i fi yfed = I don't have to drink (There is no necessity for me to drink)
In spoken English we would not use refrain in this sense. Refrain is usually used in written English but not often in modern spoken English. The sentence stands as making sense - e.g. an ex-alcholic might say this when out with friends. Or if you were having an operation the next morning and it was late at night and you had been told not to drink (as has happened with me - only "sips" of water).
I've found it really helpful, though, to understand that 'peidio a^ /ag ' means 'refrain from'. It helps me understand the structure of the Welsh. It helps me distinguish between the two sentences rmcode cites above: mae rhaid i fi beidio ag yfed : there is a necessity for me to refrain from drinking and does dim rhaid i fi yfed: there is no necessity for me to drink