As you say, it's a versatile word, and I don't think I can explain all possible usages properly.
In your example, you'd have to say "Ich kaufe das doch nicht, weil es zu teuer ist". "Doch" is one of those adverbs that have to be placed in front of the part of the sentence they modify, in this case "nicht". "Doch nicht" (or a negation + doch in general) often means that you changed your mind: Your original plan was to buy it, but now you've decided against it.
But there are other uses of "doch" that have a different meaning.
You can't use "doch" as a conjunction, you need a proper conjunction like "weil".