There is a difference between (1) Raj has an obligation to not drink milk, and (2) Raj does not have an obligation to drink milk. The English translation clearly intends (2). As for the Hindi sentence, I understand that if it was translated this way, it should also mean (2). But, if "Raj ko X hai" means "Raj has to X", then here X=not drink milk. So, I'd be inclined to think that the Hindi sentence would have to mean (1). If somebody with a stronger grasp of Hindi could clarify, I would appreciate it! Also, if it does indeed mean (2), then how would one express (1) in Hindi? Thanks, aur dhanyawad!
I am completely dreaming up stuff here, but to translate your "Raj has to not drink milk." I could imagine something like this:
राज को होना दूध नहीं पीना।
-> Raj has to be not drinking milk.
But maybe then पीना ought to change into पीता है or even पी रहा है. No idea. And probably I'm completely wrong anyway, but now I do wonder if there's such a construction possible. And of course wondering how you'd translate your (1) (if it is 2 here which is what I assume).
Have to and need to are different things in some contexts, and it is useful to learn the difference. Have implies that there is some force or rule requiring something. Need implies that it is imperative to your own success to do something. For example:
-I have to wait for the walk signal even though there are no cars or other people around to walk the street because it is the law.
-I need to cross the street now because I am late for my interview!
The first sentence I could cross the street if I wanted to illegally, it is a rule preventing me from doing so, even if I know I won't get caught because no one is around. The second sentence I am motivated to cross the street regardless of the rules because my success depends on it!