You don't say her age or how long this has been going on. It might simply be a phase she is going through. I can remember daydreaming during school...not very often, but some of them are still clear today. (I'm 57)
If this is an extreme problem though I'd suggest having her checked out by a psychologist. A psychologist can tell you, after a few simple tests, if your daughter is simply a dreamer or if there is a problem. It wouldn't hurt to remove all doubt or concerns of something else being the problem.
My son is a dreamer. It wasn't until he was a tween that we discovered that he has Asperger's Syndrome Disorder, a form of Autisim...early on he was diagnosed as having ADHD only. I am in no way suggesting that your dauhter has a mental illness. I'm simply suggesting that you rule out any possiilities.
I must add that I'm not quite sure if I would have taken another person's advice about seeking help with someone other than our family doctor. Hindsight being perfect, I should have taken him to a specialist long before I did. Our family doctor wasn't trained in recognizing the subtle signs of something other than a physical ailment.
I'm hoping that it's just a stage with your daughter, or maybe her work is too easy and she just is bored with doing it...thus the daydreaming. She may be gifted...something else that a psycholigist can determine.
Don't squelch her daydreaming...it makes for a very creative mind. Be her advocate and uncover the underlying reason. Needing glasses or a hearing aide, boredom, health (physical or mental), even where she sits in her class, could be the reason for her daydreaming or appearance of not participating. Simple tests can be done to determine your child's needs and it could be just a simple fix and all your worries will disappear. Well...you are a mom...at least your worries will diminish about this aspect of your daughter's life.
Good luck and God bless.