Don't depend on guidebooks. They only undermine what used to be a dense network of local guides, who build up the local economy and encourage good relations with tourists. Use official guides. They will get you past the con men and can help you learn how to say no. For a walk into a souk, they are indispensable.
Tell the guide what you want to see. Guides make commissions if you buy from shops they recommend, but you don't need to accept the credit-card tour. We asked our guide in Fez to show us how people lived. He introduced us to friends in the old city, including a local baker who tended a wood fire to bake loaves households had prepared. How did people know to pick up their own loaf of bread? "Any woman knows the loaf she made with her own hands," he said.
Respect privacy. Most people don't want their pictures taken. Always ask.
Set a price for every transaction in advance. The snake charmers in the market expect to be paid, but won't say so until after the picture is taken. It's hard to bargain with a man carrying a cobra. Even the official guides may tell you that they do not expect to be paid. They do, and it's best to set a price in advance.
If you're interested in big-ticket items, such as a Berber rug, count on spending time with rug merchants, drinking mint tea, and talking about anything but rugs. The key to a good bargain is a good relationship, not just a good price.
You will be solicited on the street for all sorts of things, especially by children. No one recommends giving money to children. But pens or empty film containers can be appropriate and valued gifts. Learn how to say yes. Learn when to say no. Ask to see credentials of anyone out of uniform who claims to be an official and wants you to do something.