The distance matrix API doesn't have an "avoid" option. If you include it in the query, it is simply ignored. If you look at the documentation here: https://learn.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-distance-matrix you will see that this API has only the following options: origins, destinations, travelMode, startTime, endTime, resolution, distanceUnit, timeUnit
If you need a distance matrix service that supports "avoid" consider using Azure Maps: https://learn.microsoft.com/en-us/rest/api/maps/route/post-route-matrix?view=rest-maps-2023-06-01&tabs=HTTP It's distance/route matrix API has a lot more options.