They will appreciate your honesty, because everyone understands it's difficult to remember names. Just politely and apologetically admit that it slipped your mind or that it's on the tip of your tongue but you can't think of it now.
A gentler approach is the "I know your name, but I'm blocked" dodge, where you can say something along the lines of, "I keep wanting to call you David, but I know that's not right."
Either way, make sure you do this as quickly as possible — it gets more awkward the longer you wait to ask.