I'm not doing that because I hate you
This sentence seems ambiguous to me.
When I pause (place a comma) between "that" and "because", or add "just" between them, I get the two meanings.
Someone please explain this to me?
You're absolutely correct that the sentence has two nearly opposite possible meanings:
In general, I think the meaning would be clear from context, since you'd either be doing "that" or not, and that would resolve which interpretation is correct. As you noted in your question, I would probably say the sentence differently in terms of emphasis and timing if I were trying to say #1 than I would if I were trying to say #2.
In general, if a cause is given for a negative clause with a dependent "because" clause, the meaning is ambiguous.
Firstly, this is because the scope of the negative is ambiguous, leading to two interpretations which are something like this, very roughly speaking:
The first interpretation is clear. "I am not doing that" is the main clause and states the fact. Then the second clause gives the reason: the reason why I am not doing that is that I hate you.
In the second interpretation, the "doing that because I hate you" is negated as a whole. A further ambiguity is at play here.
There is the interpretation of "I am not (doing that because I hate you)" is that: "I am doing that, but not for the reason that I hate you. It is for some different reason." This is a complicated negation which actually isn't a negation because the speaker is in fact "doing that". I suspect that this semantic interpretation of the second parse above will be favored if this sentence is presented blankly without any context.
There is another interpretation which is that the speaker is not in fact "doing that". "There is something which I could do because I hate you, but I am not going to do that". A clearer example of this might be:
We can illustrate this in another way, by completely factoring out the negation, in the following manner:
The negation is now in a separate clause, and the ambiguity remains: it could mean: "In fact, I'm not doing that at all", or "I am doing it, but for another reason".
So as you can see, there is a three-way ambiguity in the sentence which is the result of a combination of syntax and semantics.
There are ways to clarify which of the three meanings is intended:
The last one is still ambiguous, requiring the right word emphasis to get the intended meaning across, but this rewording fixes it:
As you say, the sentence is ambiguous. It could mean:
In spoken language the stress could go:
I'm not doing this because I hate you (for first sentence).
I'm not (slow) doing this (optional small pause) because I hate you (for second meaning).
But in fact even in spoken language this could be ambiguous. Seems like a good sentence to avoid! In written language the first meaning never takes a comma. I believe a comma is prescriptively optional in the second sentence.
Good example of a situation where you should use a different sentence. Perhaps:
1) "It's nothing personal." <--as often said by mobsters in movies right before whacking someone. They don't particularly hate the person; they just have a job to do.
2) "I'm not going to do that, because I hate you and would never do something to help you."