Nothing but nothing will stop deer who are hungry enough from ravaging your ornamental garden. Deer will even sometimes eat highly toxic plants. Tasty plants like Hosta are deer magnets if you live in an area where deer are endemic. Short of building an 8-foot fence around your garden (deer can easily jump anything lower) there is no sure-fire way to prevent deer from roaming about your garden.
Having said that, there are fairly effective ways to deter deer from eating and possibly destroying your garden. First, you can utilize toxic and deer-resistant plants in your garden. Second, you will need to use deer deterrents to discourage browsing. (Deer will then probably go to someone else’s garden to ravage.)
There are lots of opinions about deer deterrents, but scientific research done on the effectiveness of various deterrents suggest that only those repellents that have “putrescent egg solids” or similar artificial sulfur-based odorants as an ingredient, are statistically effective at reducing browsing. We have found that Deer-Off, a repellent containing putrescent egg solids plus capsaicin (the chemical compound responsible for the “heat” in chile peppers) is a highly effective deterrent. It works for several weeks, but must be reapplied after heavy rain. We spray it only on the most deer sensitive plants in our garden. To humans, the odor is not particularly detectable, but apparently it is highly repellent to deer and other plant-browsing pests. Animals that attempt to eat treated plants anyway get a mouthful of capsaicin, which serves as secondary deterrent, although this ingredient has not been widely studied in scientific trials. Any brand pest repellent spray with egg solids should be effective. The only negative we have found with these repellents is that they can leave unsightly “spots” on your foliage, which is especially apparent for non-variegated or darker-colored plants. Spotted plants are nicer to look at than perennial stumps or half-eaten plants, however.
We have fortuitously discovered that consistent and repeated application of deterrents early in the garden season decreases browsing throughout the year. (Deer still eat Hosta flowers in our garden but rarely attack the foliage anymore.) It is possible there is a “training factor” for resident pests who learn to avoid treated plants. This can come in handy during prolonged periods of rain. It is during such periods, when repellents get washed away and we cannot re-treat, that we have suffered the most extensive garden damage from deer.