Something like “I don’t like to chat at work”.
The other suggestions seem far too inviting for follow-up or could be perceived as sidelong attacks.
That phrasing is hard to follow-up on, though not impossible, and focuses only on you. I suspect you also don’t chat with others, so they probably can’t say something like “But you chat with Johnny?”
Talking about what they’re doing that annoys you opens a conversation about them feeling attacked or maybe trying to find alternate ways to talk to you etc. You don’t need to explain why you don’t want to chat because that will open other conversations. They probably will try to follow up or redirect, but calmly insisting that you prefer not to chat may work.
HR is generally a bad place for employees to take issues since their stated job is to protect the company from liability their employees might incur. If you have a union or some other third party resource go to them first, then go to HR if they advise it. Since HR is interested in protecting the company from liability created by employees you may be able to aim them at the other employee, but you need to be sure that’s what they’ll do before going to them, otherwise they may view you as the liability.
EDIT: And you don’t need to wait for them to ask if you’re OK. If your issue is that they’re talking about non-work and that’s not why you’re there, just bring that up immediately.
And also be clear they can still talk to you as long as it’s work related, and that you’re not refusing to work with them. Otherwise you become an HR problem.
https://duckduckgo.com/?q=2016+Clinton+pied+Piper+strategy