I AM NOT YOUR LAWYER/I AM NOT GIVING LEGAL ADVICE/SEARCH AND SEIZURE LAW CAN BE,BY ITS VERY NATURE , VERY FACT SPECIFIC
In short, you may withhold consent with a polite no. However, that may not be the end of the encounter, depending on the facts and circumstances of a particular case in a particular jurisdiction.
There are often a number a half truths in many "what can a leo do threads" often put forth by well meaning posters who may or may not be correct. The following is my understanding of federal law in the 8th Circuit (MO, AR,IA, SD, ND, NE & MN)
An officer may ask for consent to search at any time, you may refuse at any time.
Your refusal may not stop an officer from seaching your vehicle if he/she otherwise has reas suspicion/pc.
In many jurisdictions, virtually all traffic infractions are arrestable offenses. An officer could therefore arrest you for a traffic violation and search you incident to arrest and search your vehicle (to include locked containers therein) pursuant to an inventory search.
As mentioned above, an officer may search, accessable areas in the vehicle for officer safety reasons. Evidence of a crime observed in plain view, percieved via plain smell or plain feel or otherwise discovered in an area that would be accessable can constutute r/s and p/c to expand seach/investigation (This makes a lot more sense when it is one leo stopping two strapping youth at 0200 on a dark side street that two leos stoppong a 16 yr old female at 1400 on main st.)
any traffic violation, however minor, creates probable cause for a leo to stop a vehicle, even if it is a pretext for another investigation. i.e stopping a car on the highway for following too closely when you are really focusing on drug interdiction
an officer, during the course of the traffic stop may ask driver to step out of vehicle and accompany officer to his/her patrol car
an officer may ask name, destination and purpose of trip, officer may also ask passengers the same type of questions to verify information provided by driver
whether an officer has reasonable suspicion to expand the course of the stop of a traffic stop is dertermined by looking at the totality of the circumstances in light of the officer's experiences i.e nervous demenor of driver and/or passenger, inconsistent answers, lack of identification, items seen in plain view, items percieved via smell, type of vehicle, route, time of day or night etc
Asuming reasionable susp of criminal activity, an officer may detain a vehicle for a reasonable time for a dog sniff (case law has defined reasonable time to be at least 80 minutes in a particular case)
A dog sniff is not a search under the 4th, and may be performed without reasonable suspicion or probable cause (this would assume that the dog was on site at the stop almost immediately ie k-9 officer that stopped car for speeding ran dog arround the car before even contacting the driver on the stop.)
A dog alerting to the presences of contraband in a vehicle constitutes PC to search the vehicle and containers therein without a warrant.
The 4th A only porhibits unreasonble seaches not all searchs.
There are many exceptions to the warrant req of the 4thA ie
border searchs
administrative searches ie airports
automobile exception
exigent circumstances
consent
etc-this is not an exaustive list
If you dont want to consent dont. Just know that you saying no may not end the encounter. In many states you dont have the right to resist arrest, even an unlawful one. You have the right to seek redress on the back end ie civil lawsuit. I mention this because I am concerned that someone will read a post like this and needlessly escalate a situation where people can get hurt. As always YMMV.