sorry, this is not to St. Joseph, but it is a good chastity prayer. I think it was written by St. Thomas Aquinas.
Dearest Jesus! I know well that every perfect gift, and above all others that of chastity, depends upon the most powerful assistance of Thy Providence, and that without Thee a creature can do nothing. Therefore, I pray Thee to defend, with Thy grace, chastity and purity in my soul as well as in my body. And if I have ever received through my senses any impression that could stain my chastity and purity, do Thou, Who art the Supreme Lord of all my powers, take it from me, that I may with an immaculate heart advance in Thy love and service, offering myself chaste all the days of my life on the most pure altar of Thy Divinity.
Amen.