It depends on the situation. If it's something like Enhanced Hammer, the answer is no. The reason is that it is public knowledge that your opponent has no energies for you to target, so you would be unable to play the card. For anything that is considered public knowledge (in other words, areas where everybody knows the contents, like the field of play, the discard pile, etc.), the card with no target cannot be played.
If you were searching your deck, however, it is different. Since your opponent cannot see the contents of your deck, it is not considered "public knowledge." So it is a perfectly legal play to use something like Ultra Ball or Level Ball, even when there are no Pokémon left in your deck.