The Fourth Amendment of the U.S. Constitution forbids the police from conducting searches and seizures without a warrant or probable cause. In a lot of cases, they get around this by asking you for permission to conduct a search. This puts you, the driver, in a tricky situation, largely because "consensual encounters" with an armed stranger who can arrest you very seldom feel consensual.
Nevertheless, if you're driving a few miles above the speed limit, have a brake light out, or your tag is expired, and a police officer responds by pulling you over and asking to search your car, you have the right to say no, because those things by themselves are not suggestive of a crime.
The police can of course end up having probable cause if say, your car reeks of marijuana, but if they don't, consenting to a search is setting yourself up for trouble. Maybe your teenager left a joint under the seat, or maybe one magically appeared there as the officer was looking through your car. In either case, say goodbye to your car and hello to a jail cell. And if there's absolutely nothing incriminating in your vehicle, you've still had your privacy violated, your time wasted, and your nerves frayed. Don't volunteer for that.
But if a cop really wants to search your car without probable cause, a warrant, or your permission, there is a way for them to do that. The U.S. Supreme Court ruled in Illinois v. Caballes that walking a drug-sniffing dog around a car is not an unreasonable search so long as the process is not "unreasonably" long.