If you work enough - someone will eventually do something similar to you - jam the card in the deck...ask to shuffle...put you on the spot. I have used a mixture of responses.
First - I ask them why they ask me that question - they often say, "I want to see if you can do it"...this opens the door for real dialogue. What if I can? Will you think I am great? If I can't - will you think I am horrible. That is like seeing your doctor for a check up...and you ask him if he can cure cancer. If he can't - do you have a bad doctor. (To steal a line from Mitch Hedberg) Oh, you are a chef...well, can you farm? If I do this...you look bad, if I don't...I look bad - sounds like a lose-lose - I am more into win-win. Lastly, for the show to go well...I have to be in control of my actions...as if the show was up to you, well, then why am I here?
I may not say ALL of the above, but the parts that get the point across.
If someone takes a card, and jams it back into the pack...usually, I can see how far off it was to where I was having it replaced - so cound that many cards - and know that you are that far off when you are done your control - it is easy to remove or shift those cards with some thinking on your feet. If it is REALLY lost - take a look where he put it back - do a false shuffle - look at the faces in that area, and ask a few questions that will help you narrow it done...then take a guess. IF you are right - you killed - wrong...make a joke that is original to the situation...and then palm off the card...do card under glass...card to pocket...have an out. Afterall, they just want to see if you can think on your feet.
They may say, "well, you knew the card, I said it" - then say, "hmm, I didn't, but if you feel that way, please choose another" - I find putting them on the spot the second time, will allow you to hit the force for sure....if not - you are at least ready to control it and won't be caught off guard twice.
Some of the answers you got said, "you should NEVER be caught not controlling your audience" - I wonder if these people have spent time with enough audiences. You should have control of your show...but control of someone else's behaviour is ridiculous - and work enough - this situation will occur at least ONCE more than "never".
I don't think these people are Hecklers, that do this with your magic, but people that want to believe...but don't want to at the same time. If this is happening a lot, it may be your presentation. Always look at what you are doing to have situations occur - again...you can control YOUR show, not the audience...but through your show, the audience can be guided to do what isn't a natural concept - be part of a magic show. There is not natural understanding on how to be a magic show participant - as many don't see live magic until they meet you. If you claim you have real magic powers, it is not heckling to place the card back anywhere...as your magic wouldn't need a contrived replacement.
Read Strong Magic to understand more about this phase, and the importance of it - too many of us gloss over the selection and replacement part of magic...like rushing a joke just to get to the punch line - magic is more than the pay off - it is the journey of the effect that makes the effect happen...the impossiblity of the process. I digress, as per usual.
Anyhow, important topic to help you all realize, you need to be well versed in methods, so NO situation doesn't have a solution - the more tools in your belt, the less problems you can't solve.
Good luck.