Cyclopentadiene has a sp3 carbon yet it is said to be planar. I am not able to understand and haven't been able to find a credible source. Some sources say it to be non-planar
Analysis just based on ideal local geometry
[OP in comments] But here won't the carbon be strained as it is sp3 and and the bond angle is too large
In a regular pentagon, the angle at each corner is 108 degrees (tracing the pentagon, you have to turn 72 degrees at each corner: 360 / 5 = 72). In a regular tetrahedron, the angle is about 109 degrees. So just considering the bond angles, cyclopentane could be flat, while there is a good reason for cyclohexane to buckle and assume a chair conformation, again based on bond angles alone.
In pentadiene, you have four carbon atoms that should have a planar geometry with bond angles of 120 degrees. The fifth carbon atom, just considering the ideal geometry, then also has to be in the plane. The angles don't fit a perfect 360 rotation along the ring, so there will be some modest ring strain if the carbons are in a plane, or some non-ideal geometry around the double bonds if the carbons are not in a plane.
Analysis taking into account neighboring carbons
It turns out that there is no free rotation around single bonds. Ethane is staggered more often than it is eclipsed. This is the reason that cyclopentane is puckered (envelope or twist conformation). The paper mentioned in the comments to the question states that cyclopentane is in an envelope conformation, cyclopentene can become completely flat without a large energy penalty, and cyclopentadiene is flat (in terms of the carbon atoms, as nicely discussed and illustrated in the other answers).
There are two confusions here
The first source of confusion is the caused by the fact that the most common occurance of the five membered cyclopentadienyl ring isn't cyclopentadiene but the cyclopentadienyl anion commonly found in organometallic sandwich compounds like ferrocene. Her, the cyclopentadienyl unit is flat (and aromatic like benzene) as is the free ion. So many leap to assume that the this is what is being referred to if someone claims the free, neutral, cyclopentadiene is "flat". but this is a distraction and not really relevant to whether the neutral molecule is flat.
The second source of confusion is the assumption that sp3 carbons must render the molecule non-planar. But there is only 1 sp3 carbon in the 5-membered ring, the other 4 carbons are sp2 hybridised and are conjugated so driving the whole ring to be planar. This is easy to see if you build a model as non-planarity of the ring would demand that two of the sp2 carbons had angles to the sp3 that would not be "flat".
It isn't the ring that is non-planar, it is the hydrogens| attached to the sp3 carbon. The planarity of the 4 sp2 carbons "holds" the sp3 carbon in a plane as there is nothing forcing the sp3 carbon out of the plane defined by the other 4 carbons.
If you built this model with a standard physical modelling kit, it would also be obvious that the conformations of the ring where the sp3 carbon was out of the plane of the other 4 carbons was more strained.
Neutral cyclopentadiene is flat: it is only the hydrogens attached to the sp3 carbon that don't sit in the plane of the ring.