The only way currently to send HTTP request, in k6, is using the built-in k6/http module. That is completely not compatible with XMlHTTPRequest and neither "xhr2", which implements that for nodejs is doing it using the nodejs API, not the k6 one, for the obvious reasons.
As a workaround, I could propose you implement only the parts that you are using and use that. I would expect you don't use all the features that the libraries support, so it shouldn't be all that much code. This has the potential to explode in complexity especially if you are trying to map some functionality that isn't well or at all supported in k6, so I recommend trying to figure out if what you are using will translate okay to k6 if at all. For example, XMLHTTPRequest (from my fast reading, as I haven't used it many many years) does by default send request asynchronously, but this is completely not supported by k6, as it still doesn't have an event loop. There is a "workaround" for that as well but I haven't tried making it work and it just acts as if there is an event loop, but in reality it still all JS code so you won't be doing 2-3 requests in parallel.
So it is very likely that you will just not be able to use the same code and get exactly the same behavior from k6.
The above only makes sense in my opinion if you want to keep writing with those libraries going forward and run the same code in nodejs/browsers. Otherwise moving to the "k6/http" module entirely is probably going to be a lot faster and will involve less headaches.