Which of the following sounds better:
How do I cook an omelet?
– or
How to cook an omelet?
If I am asking which steps someone, in general, should take to cook an omelet.
If you start with "How to cook an omelet", with or without a question mark, I expect you to continue to give me a recipe.
The sentence sounds like a headline.
That is, there is a subject, but it has been left out (how does one cook an omelette?).
If you really just want someone to tell you how to do the job, your first sentence is much better. You could even use a generic you instead of I:
How do you cook an omelette?
(That does not necessarily ask about how the specific person you are talking to does it; the you means: how does one do it?)
That said, I am not sure I understand why you want to ask a question without a subject. That seems to be a strange restriction, and the better of the two sentences you proposed clearly has a subject.