Everyone knows that a bad neighborhood can bring down property values, and the same thing holds true on the Internet. Much like a literal bad neighborhood, an Internet bad neighborhood is filled with questionable sites, some of which may even be harmful. Linking to such sites can cause a site's search ranking to go down, and in some cases large numbers of inbound links from a bad neighborhood can also compromise search rankings.
A wide variety of sites could be considered residents of a bad neighborhood, including scraper sites, link farms, sites with large amounts of spam or malware, or sites with illegal material. If you link to such a site on your website, you could be lumped in with other sites in the bad neighborhood, and penalized as a result. Likewise, such sites may also try to inflate their search rankings by linking to you, making it look like they are affiliated with legitimate web sites, and some search engines may penalize people for this as well.
It's pretty easy to avoid linking to a bad neighborhood, but it's a good idea to check the outbound links on your site periodically. Sometimes, domains expire, and they are turned into link farms or stuffed with questionable material, so a once-valid link becomes bad. On other occasions, you may link to a site in a bad neighborhood entirely by accident, unaware that the site has large amounts of spam or malware somewhere in its depths. Spammers are also notorious for using redirects which can turn good links into bad ones. You can also link to a bad neighborhood by proxy, by linking to a site which has links to a bad neighborhood.
A number of online tools can be used to scan your domain for bad links; www.bad-neighborhood.com is a good place to start. Most of these tools are free, making them well worth the effort. You can also manually scan links on your site, which can also alert you to any security breaches; hackers are fond of trying to penetrate server protections to place links or other harmful material on websites, especially blogs.
Even a search engine knows that people sometimes make mistakes, so a single link to a bad neighborhood isn't going to boot you off the rankings. If, however, a site routinely links to questionable sites, it may start to slip in the rankings or be delisted, in extreme cases. If you think that you have been penalized in error, you can submit a claim to the search engine, asking to be re-evaluated and re-listed.