Position a sprinkler in your yard near your flowerbed. When your dog is in the yard, run the sprinkler whenever the dog tries to dig in the flowers. The dog will soon learn that his behavior will cause him to get a soaking and condition him to leave the area alone. This method will require some patience as you will have to be nearby to turn on the sprinkler when the dog draws near. It may take several attempts over more than one day to condition this behavior.
Place some small landscaping stones inside the flowerbed to discourage your dog from entering the area. Cover the entire flowerbed floor. The dog will not like the feel of walking on the little rocks and should soon learn to avoid the area. Landscaping rocks may be purchased at home and garden centers.
Position roses, cactus plants or other thorny vines around the perimeter of your flower garden to prevent your dog from entering. Dogs will avoid the prickly plants and not be able to get into the flowerbed.
Try red pepper in the flower garden. Dogs are usually repelled by pepper, and this method will work best if the dog actually tries to chew on your plants or flowers. The taste of the pepper will discourage your pet from continuing to forage in the garden. Pepper will not harm the flowers and you may use either red or black pepper to the same effect.
Place a fence around your flowerbed to prevent your dog access. You can use chicken wire, or you can purchase fancier, plastic interlocking fencing at a home and garden center. Surround the entire garden, being careful to sink the fencing into the ground at least six inches for stability. If you have a large dog, you must erect a higher fence. A general rule is to create a four-foot barrier to prevent entry.