Suppose Alice (a fictional name for this example) comes up with an novel invention idea for a machine to do very useful work, but which requires as part of the larger machine a component perpetual motion machine as its energy source. (The perpetual motion machine was patented by Bob, who never built it but licensed the patent to Alice.) Alice applies for and receives a patent without demonstrating any working model, and is never subsequently able to demonstrate a working model. The invention is never commercialized and nobody obtains the benefits of the work Alice's Marvelous Machine is not actually able to produce. Alice and Bob's patents can be assumed to be from a different country if that helps the premise seem more plausible.
Independently and slightly later, Claire comes up with a similar machine intended to accomplish the same goal, but it uses rechargeable batteries instead of the perpetual motion machine as an energy source. Claire's machine actually works and can provide the benefits that Alice's machine could not. However, substituting the energy source may be seen as relatively obvious, and the effect on its feasibility as an energy source might be seen as a reasonably predictable consequence of the swap-out. Other differences between the machines are immaterial to performance (just a result of independence of invention). Claire is applying to the USPTO.
Does Alice's patent on something that does not work prevent Claire from obtaining a patent on something that does?
Can this strategy be used to prevent patenting of an invention someone thinks would be more useful if open, even if that patenter can't quite get such an invention to work? Does Bob's patent block anybody else from patenting a perpetual motion machine?
Edited to add specific better example: Can someone patent a machine providing what they (incorrectly) think is a solution to solve an NP problem in P steps (i.e. claiming P=NP), even if not in the US, and have that block any later inventor from patenting a real solution that works? (If P=NP, such a machine would be one of the most valuable inventions to have been invented; patent rights could be very important on this.)