Is it possible? Certainly. Is it worthwhile? Depends on how sensitive you need it to be.
Dog urine has a strong ammonia component (or maybe it's just my dogs that stink so bad) that could be used as the primary analyte to look for. Unfortunately, calibrated electronic ammonia sensors are expensive. I was actually looking into this just a week ago because I raise chickens and I wanted to measure ammonia levels in my chicken coop.
Now, there are some inexpensive gas sensors that claim to detect ammonia such as this one. If you're not concerned about accuracy of the sensor, then it may work. I haven't tried them out yet since I suspect they won't work for my purposes.
What it would cost depends on how much you're willing to learn. The cheap sensors themselves are around \$30 each and can be read with about \$5 worth of parts. However, you would have to spend a fair amount of time learning electronics and interfacing to sensors.
The industrial ammonia meters are upwards of \$500 each and require replacement of the sensor element frequently. I think one of the poultry farming articles I read on the subject suggested an average yearly total cost of about \$900 per instrument.
I don't know what other easily detectable components of dog urine there are, so it's possible that there is a simpler way to detect it.