This is a very serious and inappropriate situation. First, you should firmly but gently tell her that such questions are completely unacceptable. Do not engage in any improper conversation. Then, it might be a good idea to have a conversation with your wife about this incident so that she can also take appropriate measures, such as having a talk with her niece about appropriate behavior and boundaries.
If your wife's niece has asked such an inappropriate question, you must act quickly and appropriately. Immediately correct her by stating that this is not a proper topic of conversation. You can't let this slide as it could lead to more uncomfortable or inappropriate situations in the future. Consider the cultural and family context as well. In some cultures, it might be necessary to involve the family elders to deal with this situation. At the same time, ensure that you don't overreact in a way that scares the child too much, but make it clear that such behavior is not okay.
Well, it's a tricky situation. You need to set clear boundaries right away. Say something like 'That's not an appropriate thing to ask' in a serious tone. And avoid being alone with her in situations where she might ask such things again. Also, depending on her age, it could be a sign of her being exposed to inappropriate things early, so you may need to inform her parents or guardians about this behavior.