In a few languages (the examples are from English), it seems to be common for negative morphemes to modify a verb that's "higher" in the syntactic structure of a sentence (not sure what the correct word is for directions in a tree). This causes the negative morpheme to be modifying a different verb than what you would expect if negation were strictly compositional.
For instance (1) is an utterance a native English speaker might produce, but (2a/b) would only be produced in very restricted contexts, such as a humorous answer to a question.
(1) I don't want to buy an apple. (2a) *I want not to buy an apple. / (2b) *I want to not buy an apple.
This can also occur in cases where you have a dependent clause. To my ear, (3) and (4) mean approximately the same thing, although the emphasis is different. In particular, I do not interpret (3) to mean or be consistent with "I don't know whether the Earth is flat or not".
(3) I don't think that the Earth is flat. (4) I think that the Earth is not flat.
This is sort of an interesting phenomenon, since it makes the meaning of negation non-compositional. Does it have a name? Are there languages that don't exhibit this tendency to move negative morphemes around?
Here's an example in French.
(5) Il ne faut pas réveiller le chat qui dort. It is necessary not to wake the cat that sleeps.