For the record, Bloodworms are fine to feed as a primary food, they're more or less what a betta's natural diet typically consists of. They're highly nutritious, and probably a better food source than most pellet/flake foods I've seen advertised for bettas that often have questionable ingredients and not enough protein. Omega is the only brand I've seen in any of the stores I've been to that has decent ingredients, for whatever it's worth.
Anyways, as far as your fish goes, do you salt his water at all? If not, I would start there, maybe a teaspoon or so of aquarium salt for the 2L tank. The salt does a few things, it usually makes the water a little less tolerable for bacteria and such, and usually makes the fish a little more comfortable.
When you say the tank gets unclean very quickly, what exactly do you mean? If the water gets noticeably cloudy very quickly, can happen in as little as a few hours, it's likely a bacterial bloom of some kind. I've only had that happen once, but I put maybe 5-7 drops of 3% hydrogen peroxide in the bowl, similar size to yours, and it cleared it up pretty quickly. Peroxide "decomposes" fairly quickly into water and H20, so it's pretty safe in small amounts. If this is happening again and again, there's clearly some kind of underlying bacterial imbalance, and I would probably suggest thoroughly cleaning out the tank with plenty of 3% peroxide at the next 100% water change and adding a bacterial supplement to give the good bacteria a head start. You should be able to find bacterial supplements anywhere with fish supplies, and while you're there it's always a good idea to pick up some ammonia safe just in case. Also, just to be clear, you pre-treat the water with stress coat or betta safe, or something of the sort, correct? If not, get some stress coat, it's a life saver, and untreated water isn't healthy. Also, when you change change the water, make sure the new water is at the same temperature. Personally, I just use my finger to test temperature difference, it seems more accurate to me than any thermometer I can afford. You may or may not already do all these things, just being thorough.
As far as directly treating your fish goes, it could be some kind of bacterial infection, although I think nipping at his fins can be a sign of parasites. I'd look closely and see if you notice anything on him. Either way, all kinds of medicines available anywhere you can find fish food, however be aware that many are toxic. The most effective treatments I've used for suspected bacterial infections and fin rot were simple salt baths, and highly diluted peroxide baths. I can't give you specific dosages off the top of my head, but there's plenty of information on google. I will say, be very careful with peroxide if you consider it. It can work wonders in some instances, especially involving fin rot, but too much is deadly.
Lastly, how long as your fish been without food? Food provides a lot more than just energy, and it is important that he eats in order to get better. I don't recommend it on a regular basis due to the possible risk of introducing parasites, but if your fish won't eat and you've got a lot of mosquitoes around your area, live mosquito larvae make a nutritious snack that I've never seen turned down by a betta. The betta I'm currently taking care of hadn't eaten in over a week, and was nearly entirely unresponsive, wouldn't even react to being gently poked by his captain america decoration. Throw some mosquito larvae in with him, even Mr. Comafish can't resist the temptation. Assuming it's not too cold out where you live, they're usually present in any sitting amount of water, you can even 'farm' your own just by putting a bucket of water outside in a shady place and adding a handful of dead leaves and waiting a few days. I just fish them out with a small metal strainer as they come to the surface, putting them in a small bowl with clean water and a lid. Avoid small black worm like things that are often in the water with them, here in florida at least, I think I've heard that these can sometimes be toxic. After you've caught a few nice big ones, put a good sized pinch of salt in the bowl and a few drops of peroxide and stir it around a little. No idea how effective that is at preventing waterborne parasites, but it makes me feel safer at least. It can sometimes kill some of the smaller larvae, but they're pretty hardy for the most part. After that and thoroughly washing off the small metal strainer, I fish a few out of the small bowl with it and put them in with the betta. Sometimes it can take a few minutes for the fish to notice their movements but once they do, I've never seen any betta pass them up, no matter show sick, dead, or out of it they seemed.
Anyways, best of luck. Hope he heals up and gets better.