Risks for HIV are:
1) having unprotected, penetrative anal or vaginal sex, or
2) sharing intravenous needles.
Nothing else that you can think of, including the event you described, is a risk for HIV. There is no "what if" that you can add to this scenario that would make it a risk for HIV.
If your penis did not go inside her vagina - and it did not - you have zero risk for HIV.