We get this question in various forms all the time. Do not worry about a 404 error that is completely correct- meaning that the resource does not exist and the error is correct in that respect. Do not
Mark as Fixed any 404 that is correct. It just resets the countdown clock- a certain number of retries before ignoring. This is primarily informational in GWT, but still people freak out because Google says there is an error when in reality, your scenario is perfectly correct. Do not worry about it.
Zigojacko is perfectly correct. Most of the time, these are links on sites that are discovered and incorrect. Sometimes you can find them and have them removed. But there is another side to the equation that is not covered here.
There is a whole plethora of spam sites that only last a few days or weeks as spam sites, but then can become legitimate. These sites can sometimes be found as referrer spam as well. Generally, the idea is to spam smaller more regional search engines such as in Russia and China- primarily Russia and parts of Europe where language and niche search sites exist. You will not find many of these in Google, Ahrefs, and other back link checkers and sites because of their hit and run nature. Often, databases are used to make these links so they can appear on one site for a day, then another site for a day, then go away only to return again later. These databases are passed around. Some links are created using poor spiders that generate errors. I also suspect that some links are completely made up for keyword effect.
There is nothing you can do about these spammers. The best advice is to simply correct any honestly made links that are wrong where you can and simply not worry about the rest. Generally, I do not even worry about these. Unless you are getting links in the thousands, I would suggest not worrying about them too much. If you are getting thousands of links, then it may be a deliberate negative SEO campaign. So keep your eyes open.
You can research as much as you can and I would suggest figuring out what you can.
Google does not penalize a site with 404 errors generally. Google recognizes the difference between 404 errors you created or were created else where. It is quite common for any site to see a number of broken inbound links and Google understands this very well. Just make sure your site is correct. You can use http://www.screamingfrog.co.uk/seo-spider/ to check your own site. ScreamingFrog allows for 500 pages in the free version and is rather affordable if you want to check more. It seems to be the most popular tool, but there may be others that are completely free to use so I would suggest looking around for a good tool for your purposes.