I am a single man, and sometimes think of a single girl in what would be a lustful way. Everything I have read in the bible so far seems to be about not thinking lustfully when you are married. Does it apply to single people as well?
You don’t always have control about what comes into your mind. What you do have control over is whether it stays there. For a lustful thought to come into your mind may not be something you can always control. If you keep it in your mind and possibly desire to act upon it, then it becomes wrong.
Two scriptures may apply. “Finally, brethren, whatsoever things are true, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are lovely, whatsoever things are of good report; if there be any virtue, and if there be any praise, think on these things.” (Philippians 4:8) Paul here gives a command to think on (keep your thoughts on) pure and praiseworthy things, not lustful things. “But every man is tempted, when he is drawn away of his own lust, and enticed. Then when lust hath conceived, it bringeth forth sin: and sin, when it is finished, bringeth forth death.” (James 1:14-15) Our lusts (excessive desires) lead us to sin.
So to avoid sin, and to obey a command, don’t let lustful thoughts remain in your mind. It doesn’t matter whether they are about a single woman, a married woman, or any other thing.