Can an airliner be refueled while the APU is running? Race cars can be refueled while the engine is running. I assume this is a dangerous task done by highly specialised technicians.

If ground support is not available, an airliner may keep the APU running to be able to provide power to restart the engines.

If ground support is not available and refuel is needed, can an airliner refuel while the APU is running (technically and legally)?

If the question is too broad, it can be narrowed to best sellers (B737 and A320 families).
Refueling an airliner with APU running is a perfectly normal procedure and it is done daily all around the world. The APU is located at the tail cone partially to reduce the risk of fire spreading to the fuel tanks, which are normally in the wings and center fuselage.  

Some operators and authorities (not all) restrict starting and/or stopping the APU while fueling.