The solution is having the right attitude. See, they will try to exploit your weakness. In this case, being polite is a weakness. Don't be afraid of looking rude.
Engaging in a conversation is a mistake. They'll manage to have your sympathy, and from there it will be easy for them to ask you for money, because you'll feel sorry about not giving it. You have to prevent it. Don't start talking to them. Either you say nothing at all, or you just say "No". If they come towards you keeping their hand in a way that indicates they want to shake it with you, don't. Avoiding their eye contact also helps. If you really can't find a better solution, just turn around and walk away.
Letting them come close to you is also a mistake. Sometimes you have to stop, for example to check a map or a tourist guide, or to take some pictures (which are, by the way, all things that signal that you are a tourist and therefore a good target). Try to avoid doing it where they can see you. Find a quiet corner and do it there. Sure, if you have to take a picture you can't do it at another place, but if you need to consult a map you can. And remember that, in general, a solution is to walk away from them. So if you are not in a condition that lets you do it (because you've put your backpack on the ground and you have unfolded a giant map), you are vulnerable, and they know it. Try to avoid it as much as you can.
If they do get close to you, they will try to get hold of your arm. Don't be afraid of being rude by retracting it quickly and abruptly. Again, you can even turn around and start walking in another direction if you need to. And again, don't worry about it being rude. If they do catch your wrist, don't, don't, DON'T expect them to stop tying that thing and let go of your arm just because you tell them so (even assuming they understand you). They won't. They will keep smiling all the time, and showing you how nice and friendly they are, since they just want to give you a present. If you think refusing it is rude, you've lost.
They might try to play the racism card, that is, when you do something that looks rude (but, let me repeat it once again, it isn't!), they could start saying something like "Is it because I'm black?". If you feel like you have to explain that no, you are not a racist... Don't. It's just another trick to engage in a conversation, at the end of which you will feel like you have to apologize in a tangible way, that is, you have to give them some money.
If they try to force you to take something, because they manage to put it in your hand and then they won't take it back, tell them they have to take it back or you'll just leave it on the ground. If they don't understand you, or if they ignore you (which is almost certain), just put it on the ground and walk away without saying anything.
If you feel any of this is rude, you are going to fall prey to them. It isn't rude at all. You are just preventing them from using their tricks to make you feel guilty and get you to do what they want. Remember, they can't afford being polite and respecting your desire not to have it. They have to catch any opportunity they get. They have to exploit your weakness by putting you in a situation where you seemingly have no choice, and the only polite way out is paying them. If you let them do it, they'll win.
Anyway, don't push it too far. Don't insult them, there's no need to (and it's useless). And don't be violent, ever. Someone in the comments suggested to punch them (hopefully they were just being ironic). I think I don't need to tell you it's absolutely wrong. Violence is not a solution. Nor is it such an extreme situation that you need to turn to violence to survive. Besides, they tend to be in groups, and since they have a much harder life than you, they are probably much better than you at fighting. And if you start a fight it's even possible that they will call the police, and guess what? At that point the best scenario for you is that to settle everything down you'll have to give them some money.
And about the police: yes, in general there are policemen (either the so called "Polizia", or the "Carabinieri", the military police), and even some soldiers carrying submachine guns. The latter won't help: they are there to react to terrorism, and once I read that they have explicit orders to ignore common crimes. The police, on the other hand, might help - but in general you don't need them. I wouldn't disturb them for these things.