In its discussion about Nedarim, Parshat Matot states (30:6), “VaHashem Yislach Lah, Ki Heini Aviha Otah,” “Hashem will forgive her, for her father had restrained her.” Rashi says this is talking about a woman who takes upon herself a Neder Nazir, but this woman’s father or husband overhears her and cancels it without her knowledge. (Many Poskim say that since it says “Aviha”, it is only referring to a father and his daughter, and not a husband and wife.) Rashi continues and says that if the woman transgresses and violates her Neder by either drinking wine or coming in contact with the dead, she requires Hashem’s forgiveness, even though her father cancelled her Neder.
The immediate question on Rashi is: if the woman’s Neder has already been invalidated, why does she need to ask for Hashem’s forgiveness?
An answer to the question on Rashi is that even though her father nullified her vows for her, she was not aware of that fact, and she still went ahead and violated the Neder. Although the daughter technically never committed a sin, she still had sinful intentions in her mind when she acted, and that itself requires Hashem’s forgiveness.
We can see from here that even sinful intentions without an actual sin require forgiveness. Surely, then, one who actually does sin must ask for Hashem’s forgiveness as well. Conversely, one who intends to do a Mitzvah, even if he is unsuccessful, will certainly be rewarded.