There is only one way to block ultraviolet light while outside-sunscreen, but there are many ways to get enough vitamin D-vitamins, milk, sun. In this era of increasing skin cancers, we strongly recommend sunscreen and sun protection. If you are concerned about your vitamin D level, please discuss this with your doctor.
http://www.nytimes.com/2012/04/24/science/sunscreens-and-vitamin-d.html?_r=1