Saying that it's for a friend prevents them from refusing the package or opening it. Definitely do that. In a way, it's true. And if you know that you are not outright lying, you'll be more convincing.
If they ask you what it is, don't say that you don't know; say that you didn't ask. That's true enough; you didn't ask because you already knew. But if they want to know why your friend asked you to accept the package, you could say that he or she was embarrassed to receive it at home.
Is it a guy's name on the package? What if it's a penis enlarger? That would cover your butt!
Seriously, if they are convinced that you know, you might have to make something up. If it's a guy's name on the package, I guess you might be able to say that it's condoms or something. If it's a girl's name, it's over-the-counter medication for a yeast infection. The best thing is for it to be something legal, plausible, and somewhat embarrassing to buy in person.
Or you could be almost totally honest and say that you have a "female" friend with gender issues, etc. This approach would also let you test the waters about trans issues if you've never brought them up before.