"Jeg vil gerne lære ikke at kigge i kassen."
Translation:I would like to learn not to look in the box.
how do you know which part of the sentence is negated when ikke falls in the middle?
It depends where in the sentence. If it's right after vil, it's "I don't want..", where it's at gives the current translation, and after kigge would imply that you want to learn to look "not in the box," but presumably elsewhere.