You have a problem... And like most people, you go to a store to buy something that can fix the problem. Once at the store, you realize that you can't find anything to fix the problem. You try a few more stores, then eventually go back home, and sit in your garage... then an idea comes to mind. Minutes later, you've invented something to fix the problem. You tell your friend, your wifey, your neighbor about your new invention. At some point, someone convinces you that you must patent your invention. But can you?
Generally, the first step to patenting anything is to find out if your invention has already been invented by someone else. This process is called a "patent search." Patent searches can be as fancy as you'd like it to be. You can hire a patent search group or a law firm and pay for them to conduct a very extensive patent search. Alternatively, you can forgo conducting a patent search altogether because they are technically not required. (Unless you know your invention already exists and you're willfully ignoring it.)
I always recommend my clients to conduct a patent search, and I would say a vast majority of them hire us to conduct a search and provide them with a legal opinion based on the search result. I recommend conducting a patent search because it can save you a lot of time, money, and heartache during patent prosecution. Applying for a patent is a huge investment in terms of time and money, so it's definitely not worth your investment to try to patent something that already exists. (Still, others believe that patent searches are not meaningful because patent examiners will conduct their own searches anyway and find some basis to reject your patent application 99% of the time.)
Many times though, clients are under the impression that something doesn't exist just because you can't find it in the market or you can't find it in a store. But this isn't the case. There are plenty of inventions that have been patented or are known in the art that are not sold in stores. When you apply for a patent, patent examiners don't decide whether your invention is patentable based on what you can find in stores, but based on the prior art.
Prior art means any information that is already available to the public. This includes patents and published patent applications, as well as other references and printed publications, such as journals. Prior art references can either anticipate your invention under 35 U.S.C. § 102 or render your invention obvious under 35 U.S.C. § 103. But you can argue against patent examiners and try to convince them why your invention is not anticipated or obvious in light of the prior art. So, while it is certainly not favorable that patent examiners find prior art references to reject your patent application most of the time, it's definitely not the end of the road for many patent applications.
Of course, this means there exists many patent applications claiming similar inventions. Hence, patent prosecution can get very tricky. But conducting a reasonable patent search can help both the inventor and the patent attorney prepare for what the patent examiner may find... even if it's not sold in stores.