DD has ADHD and one of the things she struggles with most is distraction, esp when she is doing something that requires a lot of concentration. I believe she "overprocesses environmental stimuli" and takes too much in. The kid coughing, the kid tapping the pencil, the kid coming back from the bathroom. I gave her a timed math test at home (just 2 minutes)...the phone rang and she stopped and spaced out. Most people would know they are being timed and keep going. She can even be distracted by a refrigerator turning on, or clouds passing over the sun creating a shadow (even if she is inside and 20 feet away from a window!). The more chaotic the envirnonment, the worse she does. I was reading an ADHD book wehre it describes these people as "scanning". Basically, they notice too much, things that other people tune out. It may have worked well 1000 years ago when they were hunting deer or rabbits, or the village was on the verge of being attacked, but now, not so much.
It could also be a case of boredom, or being distracted by her own thoughts rather than what's around her. Have you asked her? Next time she spaces out, ask her what happened. DD will tell me that her brother made a noise downstairs, or she found the pattern on the cup on the table interesting.