Assuming your son and your niece are first cousins, there are at least two ways to do what you want to do without incurring taxes or a penalty:
-Change the account beneficiary to your niece, use account funds to pay for her qualified expenses, and change the beneficiary back to your son when he needs the money.
-Roll over part of the funds from your current 529 account to a new 529 account with your niece named as the beneficiary, and use funds from the new account to pay for your niece's qualified expenses.
Q. Can I change the beneficiary of a 529 plan I have set up?
A. Yes. There are no tax consequences if you change the designated beneficiary to another member of the family. Also, any funds distributed from a 529 plan are not taxable if rolled over to another plan for the benefit of the same beneficiary or for the benefit of a member of the beneficiary’s family. So, for example, you can roll funds from the 529 for one of your children into a sibling’s plan without penalty.
https://www.irs.gov/newsroom/529-plans-questions-and-answers