Should I buffer my analog input?
If your LDR is at the end of 40m of wires, then these wires may pick up some noise or AC hum that will screw the accuracy of your ADC measurement.
First thing is to use a shielded cable ; if you use Cat5 and it's shielded Cat5 then just connect the shield to chassis ground on the arduino side. Then use two wires in a twisted pair for your LDR, not two random wires from the cable that are not in a twisted pair.
Then you need to protect the arduino input against voltage spikes the cable could pick up if there is an ESD event or a lightning strike in the general area. So add some protection diodes on the arduino side from the signal wire to VCC and GND.
And you need a filter on the arduino side to get rid of noise. This depends on the frequency of the signal you're measuring. If you use a LDR to know if it's day or night outside, then the speed is going to be pretty slow, so you can just stick a capacitor between the signal and ground, something like a 100nF ceramic. That will get rid of noise and hum, and also help with ESD protection.
The input impedance of a micro ADC inputs has two components. First there is a leakage current, that looks like a very high resistor value, and will add a bit of DC error. So look in the datasheet for this, most likely it isn't a problem. The second component of the input impedance is that SAR ADCs charge their sampling capacitor from the source when sampling, which draws a bit of charge from the source. This has two effects: it uses a current that is proportional to sampling frequency, and if source impedance is too high, the sampling cap won't have time to settle to the correct value. This is why it is sometimes necessary to add a buffer to high impedance sources. Although in your case, if you added a buffer, it would be better on the LDR side, to drive the cable with a low impedance, which reduces noise pickup.
But if the signal is slow enough, which should be the case here, the filter capacitor will do the job just fine: if you use a 10nF cap and the ADC sampling cap is 1pF, when it samples it will at most change the voltage on the filter cap by 1pF/10nF or 1 in 10000 which is much less than 1 LSB, so no problem.
So, you can get away with not buffering a high impedance signal if you use a filter cap, and you use a sampling frequency that is low enough that the ADC input current, which is proportional to sampling frequency and sampling capacitor charge, doesn't create too much error across the source impedance. In practice it works very well, I've used that trick to monitor batteries with high megohm voltage divider values, no need for opamp, just don't sample the voltage on the battery 1000 times per second.