Set an appointment with them.
I'm in my PhD as well and I have to assist two master students with their thesis. They used to ask for my help for every little problem in every moment, thus hindering my work. So I decided to setschedule a fixed time during the week to help them.
Right now I'm very busy, shall we meet on Tuesday at 11? So you can work on your problem some more time, and if you don't find a solution by that day, you can show me what you have tried so far and we'll work a way out of it.
It's important to underline that you want to see their work on the subject they're asking your help for. You have to make clear that you aren't a "solution cow", so to speak; you don't solve problems in their place, you help them figuring out their solution.
Redirect them.
I assume you're not the only person that can help them. As far as I know, a professor must have setscheduled office hours to help students. You can note down the office hours of those that may help the students that come to you, and while explaining that you can't help them because you're busy, you show them the sheet with the office hours.
Alternatively, you can probably suggest them a book or a chapter on the subject.
Sorry, I'd like to help you but I'm too busy to do it. But yeah, I remember this kind of problems. You will find what you're looking for in book A, it has a very good section about solving {X}.
Hang a "Do not disturb" sign on your door.
That is, if you don't share your office with anybody. If you can do so, make sure that your supervisor and your colleagues know that's just for students.
Just say no.
Sorry guys, I'd like to help you, but I'm too busy. You know, PhD life is hell. I'm sure you can solve it on your own!
There's nothing wrong in saying no to these student. You're busy and they haven't tried anything to solve their problems on their own. Let them just do their work and ask them to let you do yours.
When you tell them you're sorry, remember that it's your right to not help them. Right now, your priority is your PhD. You're going out of your way to help them, it's not even required from you. If you want to work from home for a week and during this week they can't find you, what will they do? They won't file a complain to the university as they would do with a professor, that's for sure. So, while telling them that you're sorry, remember that you're not depriving them of a right they have; instead, you're telling them that you can't do them a favour anymore.