Don't say "no," don't be confrontational, don't say anything. They'll be obvious about it if it's not optional.
I don't believe this is required (or even typical) in the US. Law enforcement is generally allowed to make non-mandatory requests and hope that you comply with them. A prime example is needing to explicitly invoke your right to remain silent (https://www.npr.org/templates/story/story.php?storyId=127352...). You might also look up videos of people refusing to cooperate with the immigration checkpoints in various states along the Mexican border.