The best way to negotiate the sale is to come up with your out the door price. What do you want to pay in total? Factor in sales tax and dealership fees and come up with your final number. I told them I would pay an OTD price that backed out into a couple hundred bucks under invoice.
Once you get that figured out you negotiate the trade-in. The dealer low-balled me, I countered with a number higher than what CarMax offered me... they balked and lowballed again... I pulled out the CarMax appraisal, they matched, and I got a fair price on my trade.
It's very hard for dealerships to gouge an educated consumer. The internet has changed things significantly in that, if you do your research, you shouldn't pay any more than invoice for your car. Dealerships don't like educated consumers... they like people like my aunt who doesn't know you are supposed to negotiate the selling price.